home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / OWL / BORBTN1 / BORBTN1.PAS next >
Pascal/Delphi Source File  |  1994-04-29  |  2KB  |  65 lines

  1. {************************************************}
  2. {                                                }
  3. {   ObjectWindows Demo                           }
  4. {   Copyright (c) 1992 by Borland International  }
  5. {                                                }
  6. {************************************************}
  7.  
  8. program Step01b;
  9. {Todd Kofford}
  10. {913-832-0524}
  11. uses WinTypes, WinProcs, OWindows, ODialogs, BWCC;
  12.  
  13. {$R BorBtn1}
  14.  
  15. type
  16.   PMyButton = ^TMyButton;
  17.   TMyButton = object(TButton)
  18.     function GetClassName: PChar; virtual;
  19.     procedure GetWindowClass(var AWndClass: TWndClass); virtual;
  20.   end;
  21.  
  22.   PStepWindow = ^TStepWIndow;
  23.   TStepWindow = object(TWindow)
  24.       MyButton: PMyButton;
  25.     constructor Init(P: PWindowsObject; AName: PChar);
  26.   end;
  27.  
  28.   TMyApplication = object(TApplication)
  29.     procedure InitMainWindow; virtual;
  30.   end;
  31.  
  32. constructor TStepWindow.Init(P: PWindowsObject; AName: PChar);
  33. var
  34.   Red: array[0..2] of hBitMap;
  35. begin
  36.   inherited Init(P, Aname);
  37.   Red[0] := LoadBitMap(hInstance, PChar(1101));
  38.   Red[1] := LoadBitMap(hInstance, PChar(3101));
  39.   Red[2] := LoadBitMap(hInstance, PChar(5101));
  40.   MyButton := New(PMyButton, Init(@Self, 101, 'Sam', 10, 10, 100, 100, False));
  41. end;
  42.  
  43. function TMyButton.GetClassName: PChar;
  44. begin
  45.   GetClassName := 'BorBtn';
  46. end;
  47.  
  48. procedure TMyButton.GetWindowClass(var AWndClass: TWndClass);
  49. begin
  50.   inherited GetWindowClass(AWndClass);
  51. end;
  52.  
  53. procedure TMyApplication.InitMainWindow;
  54. begin
  55.   MainWindow := New(PStepWindow, Init(nil, 'Steps'));
  56. end;
  57.  
  58. var
  59.   MyApp: TMyApplication;
  60.  
  61. begin
  62.   MyApp.Init('Steps');
  63.   MyApp.Run;
  64.   MyApp.Done;
  65. end.